<!--
 * @Author: yfp
 * @Date: 2024-03-30 20:00:53
 * @LastEditors: yehongbo 1394168736@qq.com
 * @LastEditTime: 2024-08-05 09:49:53
 * @Description: 
-->
<template>
  <div class="box">
    <div class="tips_class">
      <p class="title">{{ props.tip }}</p>
      <p class="text">{{ props.text }}</p>
    </div>
    <div>
      <el-button :type="item === 'add'|| item === 'one' || item === 'edit' ? 'primary' : 'default'" class="button_class" size="small" v-for="item in btnsArr"
        @click="clicks(item)">
        <template v-if="item === 'add'">
          <span>+</span> 新增任务
        </template>
        <template v-if="item === 'one'">
          一键生成
        </template>
        <template v-if="item === 'edit'">
          编辑
        </template>
        <template v-if="item === 'more'">
          更多
        </template>
      </el-button>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
const emit = defineEmits(["clicks"]);
const props = defineProps({
  tip: {
    type: String,
    default() {
      return "";
    },
  },
  text: {
    type: String,
    default() {
      return "";
    },
  },
  btn: {
    type: String,
    default() {
      return "";
    },
  },
});
let btns = props.btn;
let btnsArr = ref([])
if (btns && btns.length > 0) {
  btnsArr.value = btns.split(',')
}
console.log(btnsArr.value)
const clicks = (name) => {
  emit('clicks', name)
}
</script>

<style scoped>
.box {
  display: flex;
  justify-content: space-between;
  align-items: center;

  .tips_class {
    border-left: 5px solid #409eff;
    padding-left: 20px;
    margin: 10px 20px 10px 0;
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;

    .title {
      font-size: 18px;
      font-weight: bold;
      margin-right: 5px;
      vertical-align: bottom;
    }

    .text {
      font-size: 14px;
      color: #bec0c6
    }
  }
}

.button_class {
  border-radius: 5px;
  margin: 10px 0 10px 10px;
  text-align: left;

  span {
    font-size: 20px;
    margin-right: 10px;
  }
}
</style>
